﻿#region File Info Header
/*________________________________________________________________________________________

  Copyright (C) 2011 Jason Zhang, eagleboost@msn.com

  * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
  * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

________________________________________________________________________________________*/
#endregion File Info Header

namespace EagleBoost.Wpf.Presentation.Converters
{
  using System;
  using System.Windows.Data;
  using System.Globalization;
  using System.Windows.Media;

  /// <summary>
  /// ColorToBrushConverter
  /// </summary>
  [ValueConversion(typeof(Color), typeof(SolidColorBrush))]
  public class ColorToBrushConverter : ConverterMarkupExtension<ColorToBrushConverter>, IValueConverter
  {
    #region IValueConverter Members
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
      if (value is Color)
      {
        return new SolidColorBrush((Color)value);
      }

      return null;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
      throw new NotImplementedException();
    }
    #endregion IValueConverter Members
  }
}
